Skip to content

Abort iteration when fs-event-incapable #2867

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

Shaobin-Jiang
Copy link

Fixes #2866. The original code, while detecting whether Windows NT allows the dir to be iterated through, will go to the other branch of the if...else... statement, which is intended for cases when filter_reason is not none. Simply moving is_fs_event_capable into the first branch should solve the problem.

Fixes nvim-tree#2866. The original code, while detecting whether Windows NT
allows the dir to be iterated through, will go to the other branch
of the if...else... statement, which is intended for cases when
filter_reason is not none. Simply moving `is_fs_event_capable` into the
first branch should solve the problem.
Copy link
Member

@alex-courtis alex-courtis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be most grateful for your review @evertonse

if link.link_to ~= nil then
child = link
if filter_reason == FILTER_REASON.none and not nodes_by_path[abs] then
if Watcher.is_fs_event_capable(abs) then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be a change in behaviour for all users; unfortunately we can't do that.

if child then
table.insert(node.nodes, child)
nodes_by_path[child.absolute_path] = true
explorer_node.update_git_status(child, node_ignored, git_status)
end
else
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was added recently and appears it will execute despite is_fs_event_capable fail.

I reckon we should wrap that test around the whole block, something like:

    local abs = utils.path_join { cwd, name }
    if Watcher.is_fs_event_capable(abs) then

Defering to @evertonse on this one :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could live dangerously and optimise this a little, only testing when t == "directory" as per:

if t == "directory" and vim.loop.fs_access(abs, "R") and Watcher.is_fs_event_capable(abs) then

@alex-courtis
Copy link
Member

Superceded by #2874

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issue on windows when trying to iterate through the Appliction Data directory(not the AppData directory)(Confusing I know)
2 participants